<% layout("/common/layout.html",{"title":"管理账号"}){ %>
<div class="row wrapper border-bottom white-bg page-heading">
    <div class="col-sm-8">
        <h2>管理账号</h2>
        <ol class="breadcrumb">
            <li><a href="${ctxPath}/admin/main">主页</a></li>
            <li><a>系统权限管理</a></li>
            <li class="active">管理账号</li>
        </ol>
    </div>
    <div class="col-sm-4">
        <div class="title-action"></div>
    </div>
</div>
<div class="wrapper wrapper-content">
    <div class="ibox float-e-margins animated fadeIn">
        <div class="ibox-content">
            <table id="adminUserList"></table>
            <div class="toolBar" style="margin:0 -15px;">
                <div class="col-sm-8">
                    <div class="btn-group">
                        <% if(shiro.hasPermission("/adminUser/save/action")){ %>
                        <a class="btn btn-primary btn-outline toolbar-save"><i class="fa fa-plus-square"> </i> 添加</a>
                        <% } %>
                        <a class="btn btn-primary btn-outline toolbar-refresh"><i class="fa fa-refresh"> </i> 刷新</a>
                        <% if(shiro.hasPermission("/adminUser/save/action")){ %>
                        <a class="btn btn-primary btn-outline toolbar-batchStatus"><i class="fa fa-gear"> </i>
                            批量更改状态</a>
                        <% } %>
                    </div>
                </div>
                <div class="col-sm-4">
                    <div class="input-group">
                        <input type="text" placeholder="请输入名称或标示关键词" class="form-control searchValue">
                        <span class="input-group-btn">
                            <button type="button" id="search" class="btn btn-primary">
                                <i class="fa fa-search"></i>&nbsp;搜索
                            </button>
                        </span>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
<% } %>
<script type="text/javascript">
    //页面JS调用
    require(['admin/user'], function (user) {
        user.list();
    });
    //列表参数
    function operateFormatter(value, row, index) {
        var resultCode = "";
        <% if(shiro.hasPermission("/adminUser/status/action")) { %>
            if (row.status == 1) {
               resultCode += '<button type="button" class="status btn btn-white btn-xs"><i class="fa fa-ban"></i>&nbsp;禁用&nbsp;</button>';
            }
            else {
              resultCode += '<button type="button" class="status btn btn-white btn-xs"><i class="fa fa-check"></i>&nbsp;启用&nbsp;</button>';
            }
        <% } %>
        <% if(shiro.hasPermission("/adminUser/save/action")) { %>
            resultCode += '<button type="button" class="update btn btn-white btn-xs"><i class="fa fa-pencil"></i>&nbsp;编辑&nbsp;</button>';
        <% } %>
        <% if(shiro.hasPermission("/adminUser/password/action")) { %>
            resultCode += '<button type="button" class="change btn btn-white btn-xs"><i class="fa fa-key"></i>&nbsp;改密&nbsp;</button>';
        <% } %>
        return '<div class="btn-group">' + resultCode + '</div>';
    }
</script>